home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir43
/
qsrc_dsk.zip
/
MODEL
/
ASK.PRG
next >
Wrap
Text File
|
1991-12-17
|
8KB
|
220 lines
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ 12/17/91 ASK.PRG 11:01:30 ║
* ║ ║
* ╟─────────────────────────────────────────────────────────╢
* ║ ║
* ║ Lisa C. Slater and Steven E. Arnott ║
* ║ ║
* ║ Copyright (c) 1991 ║
* ║ Application developed for _Using FoxPro 2_ ║
* ║ Que Publishing Corporation ║
* ║ ISBN 0-88022-703-6 ║
* ║ ║
* ║ Description: ║
* ║ This program was automatically generated by GENSCRN. ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ ASK Setup Code - SECTION 1 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
#REGION 1
PARAMETERS m.question, m.value,m.valid
novalid = (PARAMETERS() = 2)
* this screen is called with its SAY,
* its GET, and any necessary PICTURE for
* the validation of the GET. A dummy GET
* of null length is used in the SCX to
* call the real GET.
* m.question can be up to 47 chars -- you
* can adjust this if you make the window bigger.
* m.value can be of any TYPE except memo.
* ordinarily you initialize the value before
* calling the ASK.SPR, which helps ASK determine
* the necessary length of the GET, like this:
* seekcode = product.prodcode
* DO ASK.SPR WITH "Product to seek:",seekcode,"@! AAA99"
* or:
* yesno = "NO " && see note one line down
* DO ASK.SPR WITH "Ready now?",yesno,"@M NO, YES"
* (in the @M case the extra space should be used
* if the initial value of m.value is not its
* longest possible value)
* if you generate the screen with the non-default
* PRG extension, you can use ASK as a UDF and
* the appropriate new value will be returned;
* in that case you don't initialize it first,
* and you'd call it like this:
* seekcode = ASK("Product to find:",product.prodcode,"@! AAA99")
* bigitem = ASK("Smallest item to mark:",0,"9999")
* This is demonstrated in the Pack procedure of
* WIDGET2.MPR.
* m.valid is not required.
* If you want to use FUNCTION as well as
* or instead of PICTURE, just include your
* FUNCTION codes with the @ symbol in m.valid
* as shown above and it will be parsed properly.
#REGION 0
REGIONAL m.currarea, m.talkstat, m.compstat
IF SET("TALK") = "ON"
SET TALK OFF
m.talkstat = "ON"
ELSE
m.talkstat = "OFF"
ENDIF
m.compstat = SET("COMPATIBLE")
SET COMPATIBLE FOXPLUS
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ Window definitions ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
IF NOT WEXIST("_q1g0nmphf")
DEFINE WINDOW _q1g0nmphf ;
FROM INT((SROW()-7)/2),INT((SCOL()-50)/2) ;
TO INT((SROW()-7)/2)+6,INT((SCOL()-50)/2)+49 ;
FLOAT ;
NOCLOSE ;
SHADOW ;
DOUBLE ;
COLOR SCHEME 5
ENDIF
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ ASK Setup Code - SECTION 2 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
#REGION 1
* initialize dummy variable
m.dummy =""
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ ASK Screen Layout ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
#REGION 1
IF WVISIBLE("_q1g0nmphf")
ACTIVATE WINDOW _q1g0nmphf SAME
ELSE
ACTIVATE WINDOW _q1g0nmphf NOSHOW
ENDIF
@ 1,0 SAY padc(m.question,47) ;
SIZE 1,46 ;
PICTURE "@I" ;
COLOR W+/RB
@ 3,23 GET m.dummy ;
SIZE 1,1 ;
DEFAULT " " ;
WHEN _q1g0nmske()
IF NOT WVISIBLE("_q1g0nmphf")
ACTIVATE WINDOW _q1g0nmphf
ENDIF
READ CYCLE
RELEASE WINDOW _q1g0nmphf
#REGION 0
IF m.talkstat = "ON"
SET TALK ON
ENDIF
IF m.compstat = "ON"
SET COMPATIBLE ON
ENDIF
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ ASK Cleanup Code ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
#REGION 1
* will only be used if the screen is going to be
* generated as a UDF with a PRG extension
RETURN m.value
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q1G0NMSKE m.dummy WHEN ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: ASK, Record Number: 3 ║
* ║ Variable: m.dummy ║
* ║ Called By: WHEN Clause ║
* ║ Object Type: Field ║
* ║ Snippet Number: 1 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q1g0nmske && m.dummy WHEN
#REGION 1
PRIVATE temp, msize, getcol
DO CASE
CASE "@M" $ m.valid
temp = LEN(m.value)
* don't trim this one;
* use the way the sample/initial value is
* set up (with an extra space if necessary,
* if the initial value is not the longest one)
* to format the @M-type GET properly
CASE TYPE("m.value") = "C" AND (! novalid) AND ;
"@" $ m.valid AND " " $ m.valid
temp = LEN(m.valid)-AT(" ",m.valid)
* get rid of the function codes to find the
* length of the GET
CASE TYPE("m.value") = "C" AND (novalid OR "@" $ m.valid)
temp = LEN(ALLTRIM(m.value))
CASE TYPE("m.value") = "C"
temp = LEN(ALLTRIM(m.valid))
CASE TYPE("m.value") = "N"
temp = IIF(novalid,LEN(ALLTRIM(STR(m.value))),;
LEN(m.valid)-AT(" ",m.valid))
CASE TYPE("m.value") = "D"
temp = IIF(SET("CENTURY") = "ON",10,8)
CASE TYPE("m.value") = "L"
temp = 1
ENDCASE
getcol = 23-INT(temp/2)
msize = "1,"+ALLTRIM(STR(temp))
IF novalid
@3,getcol GET m.value SIZE &msize
ELSE
temp = ALLTRIM(m.valid)
@3,getcol GET m.value PICTURE (temp) SIZE &msize
ENDIF
READ MODAL
CLEAR READ
RETURN .F.